﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;
using System.IO;
using System.Text.RegularExpressions;
using System.Configuration;

namespace NetManager_Server
{
    public partial class FormBangGia : Form
    {
        public FormBangGia()
        {
            InitializeComponent();
        }
        function fn = new function();
        ket_noi kn = new ket_noi();
        DataSet dts;
        private void dongia_TextChanged(object sender, EventArgs e)
        {
            if (dongia.Text != "")
            {
                this.lbdongia.Text = "";
            }
        }

        private void dongia_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (!Char.IsDigit(e.KeyChar) && !Char.IsControl(e.KeyChar))
            {
                e.Handled = true;
            }
        }

        private void btthoat_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btthem_Click(object sender, EventArgs e)
        {
            if (dongia.Text == "")
            {
                this.lbdongia.Text = "Vui lòng nhập giá của đơn giá !";
                dongia.Focus();
            }
            else
            {
                dts = fn.AddDonGia(dongia.Text, date.Text);
                view.DataSource = dts.Tables[0];
            }
        }

        private void FormBangGia_Load(object sender, EventArgs e)
        {
            dts = fn.LoadData("BANGGIA");
            view.DataSource = dts.Tables[0];
        }
    }
}
